﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using MODEL;
using UsersDAL;

namespace DAL
{
    public class StarDAL
    {
        private Stars ToStar(DataRow row)
        {
            Stars model = new Stars();
            model.Id = (System.Int32)sqlHelper.GetToDbvalue(row["Id"]);
            model.Star = (System.String)sqlHelper.GetToDbvalue(row["Star"]);
            return model;
        }
        public Stars[] GetAll()
        {
            DataTable table = sqlHelper.ExecuteDataTable("select *from Star");
            Stars[] models = new Stars[table.Rows.Count];
            for (int i = 0; i < table.Rows.Count; i++)
            {
                DataRow row = table.Rows[i];
                models[i] = ToStar(row);
            }
            return models;
        }
    }
}
